package com.lzwork.gpt.db.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import com.lzwork.gpt.db.entity.ApiEditEntity;
import com.lzwork.gpt.db.entity.ApiEntity;
import com.lzwork.gpt.db.entity.ApiLogEntity;
import com.lzwork.gpt.db.entity.AppEntity;
import com.lzwork.gpt.db.entity.ModelEntity;

/**
 * @author LiZheng
 * @date 2023年11月21日 下午5:02:31
 */

@Component
@Mapper
public interface ModelDbMapper
{
	// Total items
	public List<ModelEntity> getAllModel();

	public List<ApiEntity> getAllApi();

	public List<ApiEntity> getAllApiInfo();

	public List<ApiLogEntity> getAllLog();

	public List<AppEntity> getAllApp();

	public List<AppEntity> getAllAppInfo();

	// Model

	public ModelEntity getModelById(int id);

	public Integer createModel(ModelEntity model);

	public void updateModel(ModelEntity model);

	public Integer deleteModel(int id);

	// Api

	public ApiEntity getApiById(int id);

	public ApiEntity getApiByApikey(String apikey);

	public ApiEntity getApiInfoById(int id);

	public ApiEntity getApiInfoByApikey(String apikey);

	public Integer createApi(ApiEntity api);

	public void updateApi(ApiEntity api);

	public Integer deleteApi(int id);

	// Api Edit

	public ApiEditEntity getApiEditById(int id);

	public void createApiEdit(ApiEditEntity api);

	public void updateApiEdit(ApiEditEntity api);

	public int setApikey(@Param("api") int api, @Param("apikey") String apikey);

	public Integer deleteApiEdit(int id);

	// Api Log

	public List<ApiLogEntity> getLogByApi(int api);

	public Integer getLogNum(int api);

	public Integer addLog(ApiLogEntity log);

	public Integer deleteLog(@Param("api") int api, @Param("id") int id);

	// App

	public AppEntity getAppById(int id);

	public AppEntity getAppByAppkey(String appkey);

	public Integer createApp(AppEntity api);

	public void updateApp(AppEntity api);

	public Integer deleteApp(int id);
}
